<template>
	<view class="messageNotification">
		<view class="oneList" v-for="(item,i) in list" @click="onSkip(`/package/mine/messageDetails?id=${item.id}&time=${item.createtime}`)">
			<view class="title">{{item.title}}</view>
			<view>{{item.createtime}}</view>
			<view class="content" v-html="item.content"> </view>
		</view>
		<view class="flex-center addressImgBox" v-if="list.length==0">
			<image src="https://wx.2024csnl.com/static/noData.png"></image>
			暂无数据~
		</view>
		<view style="text-align: center;color: #999;" v-if="noMoreData&&list.length!=0">没有更多啦~</view>
	</view>
</template>

<script>
	import {
		getInformation
	} from "../../api/index.js"
	export default {
		data() {
			return {
				list: [],
				noMoreData: false,
				pagenum: 1,
			}
		},
		onLoad() {
			this.onGetInformation()
		},
		onReachBottom() {
			if (this.list.length != 0) {
				this.pagenum += 1
				this.onGetInformation('bottom')
			}
		},
		methods: {
			async onGetInformation(type) {
				const res = await getInformation(`s=/ApiZwyRequest/messagelist&pagenum=${this.pagenum}`)
				const {
					data,
					status,
					msg
				} = res.data
				if (status == 1) {
					console.log(res, "res----")
					type == 'bottom' ? this.list.push(...data) : this.list = data
					console.log(this.list)
					this.pagenum != 1 && data.length == 0 ? this.noMoreData = true : this.noMoreData = false
				} else {
					this.showToast(msg)
				}
			},

		}
	}
</script>

<style lang="scss" scoped>
	.addressImgBox {
		flex-direction: column;
		color: #999;
		padding-top: 20%;

		image {
			width: 400rpx;
			height: 400rpx;
		}
	}

	.messageNotification {
		padding: 30rpx 30rpx 100rpx;
		color: #818181;
		font-size: 26rpx;
		min-height: 90vh;
		background: rgb(247, 247, 247);
	}

	.content {
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
	}

	.oneList {
		padding: 26rpx;
		background: #fff;
		border-radius: 10rpx;
		margin-bottom: 20rpx;
		line-height: 40rpx;
	}

	.title {
		color: #222222;
		margin-bottom: 30rpx;
		font-size: 32rpx;

	}
</style>
